package com.jincp.filepicker.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * =========================================================
 * @ProjectName:
 * @ClassName: ImageFile
 * @Description:
 * @Author: jincp
 * @CreateDate: 2019/3/22 21:17
 * =========================================================
 */
public class ImageFile extends BaseFile implements Parcelable {
    private int orientation;   //0, 90, 180, 270

    public int getOrientation() {
        return orientation;
    }

    public void setOrientation(int orientation) {
        this.orientation = orientation;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(getId());
        dest.writeString(getName());
        dest.writeString(getPath());
        dest.writeLong(getSize());
        dest.writeString(getDirectoryId());
        dest.writeString(getDirectoryName());
        dest.writeLong(getDate());
        dest.writeInt(orientation);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<ImageFile> CREATOR = new Creator<ImageFile>() {
        @Override
        public ImageFile[] newArray(int size) {
            return new ImageFile[size];
        }

        @Override
        public ImageFile createFromParcel(Parcel in) {
            ImageFile file = new ImageFile();
            file.setId(in.readLong());
            file.setName(in.readString());
            file.setPath(in.readString());
            file.setSize(in.readLong());
            file.setDirectoryId(in.readString());
            file.setDirectoryName(in.readString());
            file.setDate(in.readLong());
            file.setOrientation(in.readInt());
            return file;
        }
    };
}
